package com.ztjava.core;


import com.jfinal.plugin.activerecord.cache.ICache;
import com.jfinal.plugin.redis.Cache;
import com.jfinal.plugin.redis.Redis;

public class MyRedisCache implements ICache{

	@Override
	public <T> T get(String cacheName, Object key) {
		Cache cache = Redis.use();
		return cache.hget(cacheName,key);
	}

	@Override
	public void put(String cacheName, Object key, Object value) {
		Cache cache = Redis.use();
		cache.hset(cacheName,key,value);
	}

	@Override
	public void remove(String cacheName, Object key) {
		Cache cache = Redis.use();
		cache.hdel(cacheName,key);
	}

	@Override
	public void removeAll(String cacheName) {
		Cache cache = Redis.use();
		cache.del(cacheName);
	}
}
